/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import model.Film;
import model.SocialMediaBericht;

/**
 *
 * @author Matthy & Jelle
 */
public class SocialMediaBerichtService extends AbstractService{

  public boolean coupleFilm(SocialMediaBericht smb) {
    FilmService fs = new FilmService();
    Film f = fs.getFilmByName(smb.getFilmNaam());
    if (f != null) {
      smb.setFilm(f);
      return true;
    }
    return false;
  }

  @Override
  public boolean validate(Object o) {
    SocialMediaBericht smb = (SocialMediaBericht) o;
    if (smb.getFilm() != null || this.coupleFilm(smb)) {
      FilmService fs = new FilmService();
      return fs.validate(smb.getFilm());
    }
    return false;
  }

}
